﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Clases.Gestores;

namespace CECWeb
{
    public partial class WebForm3 : System.Web.UI.Page
    {

        
        protected void Page_Load(object sender, EventArgs e)
        {
            cargarGrupo();
        }
        public void cargarGrupo() {

            if (!Page.IsPostBack)

            {
                DropGrupo.DataSource = GestorGrupo.listarGrupos();
                DropGrupo.DataValueField = "codigoGrupo";
                DropGrupo.DataBind();
            }
        }
        protected void Aceptar_Click1(object sender, EventArgs e)
        {
            string tema = TxtTema.Text;
            string grupo = DropGrupo.SelectedValue;
            string calificacion =TxtCalificación.Text;
            int maxAprtes = Int32.Parse(TxtAportesTotales.Text);
            int maxAprtesUsuario = Int32.Parse(TxtAportesUsuario.Text);
            Boolean publico = false;
            
            if (RadioSI.Checked)
            { publico = true; }
            else if (RadioNO.Checked)
            { publico = false; }
            try
            {
               GestorTema.insetarTemas(tema, grupo,calificacion,maxAprtes,maxAprtesUsuario,publico);
               
               Response.Redirect("Foro.aspx");
            }
            catch (Exception)
            {

                throw;
            }
        }
        protected void TxtCalificación_TextChanged(object sender, EventArgs e)
        {

        }
        protected void RadioSI_CheckedChanged(object sender, EventArgs e)
        {

        }
        protected void RadioNO_CheckedChanged(object sender, EventArgs e)
        {

        }

        protected void TxtGrupo_TextChanged(object sender, EventArgs e)
        {

        }

        protected void TxtTema_TextChanged(object sender, EventArgs e)
        {

        }

        protected void aceptar_Click(object sender, EventArgs e)
        {

        }

        protected void RadioSI_CheckedChanged1(object sender, EventArgs e)
        {

        }

        protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
        {

        }

        protected void TxtTema_TextChanged1(object sender, EventArgs e)
        {

        }

        protected void RadioButton2_CheckedChanged(object sender, EventArgs e)
        {

        }
        protected void TxtAportesUsuario_TextChanged(object sender, EventArgs e)
        {

        }

        protected void TxtCalificación_TextChanged1(object sender, EventArgs e)
        {

        }

        protected void Cancelar_Click(object sender, EventArgs e)
        {
            Response.Redirect("Foro.aspx");
        }

        protected void DropGrupo_SelectedIndexChanged(object sender, EventArgs e)
        {
           
        }

        

       

    }

}